package cache_service

import (
	"memCache/cache"
	"time"
)

type CacheService struct {
	memCache cache.Cache
}

func (cs *CacheService) SetMaxMemory(size string) bool {
	return cs.memCache.SetMaxMemory(size)
}
func (cs *CacheService) Set(Key string, val interface{}, expire ...time.Duration) bool {
	expireTs := time.Second * 0
	if len(expire) > 0 {
		expireTs = expire[0]
	}
	return cs.memCache.Set(Key, val, expireTs)
}
func (cs *CacheService) Get(key string) (interface{}, bool) {
	return cs.memCache.Get(key)
}
func (cs *CacheService) Del(key string) bool {
	return cs.memCache.Del(key)
}
func (cs *CacheService) Exists(key string) bool {
	return cs.memCache.Exists(key)
}
func (cs *CacheService) Flush() bool {
	return cs.memCache.Flush()
}
func (cs *CacheService) Keys() int64 {
	return cs.memCache.Keys()

}
